package intjavatorpedo.ws;

import intjavatorpedo.db.BombResult;
import intjavatorpedo.db.MyTurnResult;
import intjavatorpedo.db.Ship;
import intjavatorpedo.db.User;
import intjavatorpedo.db.UserTable;

import java.util.List;

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService
public interface TorpedoInterface {
	// Return false if user already exists
	@WebMethod
	public boolean addUser(String userName);
	
	// Returns the current users
	@WebMethod
	public List<User> getUsers();

	// Return game number, -1 if user is occupied
	@WebMethod
	public int startGameWithUser(String userName, String otherUserName, boolean randomShips);

	// True if the ship was put
	@WebMethod
	public boolean putShip(int gameNumber, String userName, Ship ship);

	// True if the user's guess was good
	@WebMethod
	public BombResult userGuess(int gameNumber, String userName, int x, int y);

	// Returns the current game status of the user
	@WebMethod
	public UserTable getGameStatus(int gameNumber, String userName);
	
	// Returns true, if the other user is started playing too
	@WebMethod
	public boolean otherUserStarted(int gameNumber, String userName);

	// Returns the current game status of the user
	@WebMethod
	public boolean userWon(int gameNumber, String userName);
	
	// Returns true if it is the user's turn
	@WebMethod
	public MyTurnResult isMyTurn(int gameNumber, String userName);
}